<template>
    <el-form class="self_form" ref="form" :model="form" label-width="80px">
        <el-form-item label="活动名称">
            <el-input v-model="form.name"></el-input>
        </el-form-item>
        <el-form-item label="活动区域">
            <el-select v-model="form.region" placeholder="请选择活动区域">
                <el-option label="区域一" value="shanghai"></el-option>
                <el-option label="区域二" value="beijing"></el-option>
            </el-select>
        </el-form-item>
        <el-form-item label="即时配送">
            <el-switch v-model="form.delivery"></el-switch>
        </el-form-item>
        <el-form-item label="特殊资源">
            <el-radio-group v-model="form.resource">
                <el-radio label="线上品牌商赞助"></el-radio>
                <el-radio label="线下场地免费"></el-radio>
            </el-radio-group>
        </el-form-item>
        <el-form-item label="选择文件">
            <AvatarUpload
                    v-model="fileId"
            />
          <!--  <AvatarUpload
                    upload-url="/system/user/avatar/upload"
                    file-size="4"
                    file-type="image/jpeg,image/jpg"
                    @handleAvatarSuccess="handleAvatarSuccess"
                    @handleAvatarError="handleAvatarError"
                    @beforeAvatarUpload="beforeAvatarUpload"
            />-->
        </el-form-item>
        <el-form-item>
            <el-button type="primary" @click="onSubmit">立即创建</el-button>
            <el-button>取消</el-button>
        </el-form-item>
    </el-form>
</template>

<script>

    import AvatarUpload from "../components/AvatarUpload";

    export default {
        components: {AvatarUpload},
        data() {
            return {
                fileId: '',
                form: {
                    name: '',
                    region: '',
                    date1: '',
                    date2: '',
                    delivery: false,
                    resource: '',
                    content: '',
                }
            }
        },
        watch: {
            fileId(val) {
                this.$notify({
                    title: '返回的文件 id 为',
                    message: val,
                    type: 'success'
                });
            }
        },
        methods: {
            onSubmit() {
                console.log('submit!');
            },
            success(res) {
                console.log(res)
            },
        }
    }
</script>

<style scoped>
    .self_form {
        padding: 30px 30px;
    }
</style>